package com.ocom.srvpaccess.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ocom.common.entity.master.EntityWechatPerInfo;
import com.ocom.common.enums.DataSourceEnum;
import com.ocom.common.enums.MasterSlaveEnum;
import com.ocom.common.utils.StringUtils;
import com.ocom.mysql.aspect.DataSourceAspect;
import com.ocom.srvpaccess.dao.IDaoWechatPerInfo;
import com.ocom.srvpaccess.service.WechatPerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;


@Service
public class WechatperInfoServiceImpl extends ServiceImpl<IDaoWechatPerInfo, EntityWechatPerInfo> implements WechatPerInfoService {

    @Autowired
    private IDaoWechatPerInfo daoWechatPerInfo;


    @DataSourceAspect(type = DataSourceEnum.MAIN_DB,isMaster = MasterSlaveEnum.SLAVE)
    @Override
    public EntityWechatPerInfo getWechatPerInfo(Long comId, Long pId) {
        QueryWrapper<EntityWechatPerInfo> query = Wrappers.query();
        query.eq("com_id",comId);
        query.eq("p_id",pId);
        return daoWechatPerInfo.selectOne(query);
    }
}
